#ifndef THREADQUEUE_H
#define THREADQUEUE_H
#include <string>
#include <list>
#include <mutex>
template <class T>
class ThreadQueue
{
public:
    ThreadQueue(){}
    size_t size();
    bool isEmpty();

    void push_back(T el);
    T front();
    T pop_front();

private:
    std::list<T> data;
    std::mutex locker;
};


template <class T>
size_t ThreadQueue<T>::size(){
    locker.lock();
    size_t s = data.size();
    locker.unlock();
    return s;
}
template <class T>
bool ThreadQueue<T>::isEmpty(){
    locker.lock();
    bool e = data.empty();
    locker.unlock();
    return e;
}

template <class T>
void ThreadQueue<T>::push_back(T el){
    locker.lock();
    data.push_back(el);
    locker.unlock();
}

template <class T>
T ThreadQueue<T>::front(){
    T temp;
    locker.lock();
    temp = data.front();
    locker.unlock();
    return temp;
}

template <class T>
T ThreadQueue<T>::pop_front(){
    T temp;
    locker.lock();
    temp = data.front();
    data.pop_front();
    locker.unlock();
    return temp;
}
#endif // THREADQUEUE_H
